<template>
	<section class="main_" v-loading="loading">

	</section>
</template>

<script>
import moment from 'moment'
	export default {
		data() {
			return {
				loading : false ,
				tableData: [],
				options: [{ value: 3, label: '全部' }, { value: 0, label: '待审核' }, { value: 1, label: '已认证' }, { value: 2, label: '已拒绝' }],
				search : { type : 3} ,
				page : { skip : 0 ,limit : 10 ,count : 0},
				examineData : {isShow : false ,row : {} , msg : ''} 
			}
		},
		methods: {
			delUser : function (res ){//删除商家
				this.$confirm('此操作会将商家关联的所有商店也会删除, 是否继续?', '提示', {
          	confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'
				}).then(() => {
					this.loading = true ;
					this.$http.post('/api/admin/delUserById',{_id : res }).then(res => {
						this.loading = false ;
						let result = res.data ;
						if(result.code == 100){
							this.$message({
								type: 'success',
								message: '删除成功!'
							});
						}
						this.initList();
					})
				});
			},
			examine : function (res ){//打开审核面板
				this.examineData.isShow = true ;
				this.examineData.row = res ;
				this.examineData.msg = '';
			},
			adopt : function (res , num ,msg) {//调用审核接口
				this.loading = true ;
				this.examineData.isShow = false ;
				this.$http.post('/api/admin/examine',{data : res , type : num ,msg : msg}).then(res => {
					this.loading = false ;
					let result = res.data ;
					if(result.code == 100){
						this.$message({
							type: "success",
							message: "操作成功~"
						});
					}
					if(result.code == 101){
						this.$message({
							type: "error",
							message: result.errMsg
						});
					}
					this.initList();
				})
			},
			handleCurrentChange: function(res) {
					if (res == 1)
							this.page.skip = 0;
					else
							this.page.skip = (res - 1) * this.page.limit
					this.initList();
			},
			handleSizeChange: function(res) {
					this.page.limit = res;
					this.initList();
			},
			formateDate(res){
				return moment(res.createDate).format('YYYY-MM-DD HH:mm');
			},
      initList : function () {
				this.loading = true ;
        this.$http.post('/api/admin/queryAuthList',{search : this.search , page : this.page }).then(res => {
					this.loading = false ;
          let result = res.data;
          if(result.code == 100 ){
						this.tableData = result.data ;
						this.page.count = result.count ;
          }
        })
      }
		},
		created() {
		}
	}

</script>

<style scoped lang="scss">
</style>